/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ui.components.modeltabele;

import domen.Fakultet;
import domen.Kontakt;
import java.util.HashMap;
import javax.swing.table.AbstractTableModel;
import model.StorageBroker;

/**
 *
 * @author Vlada
 */
public class KontaktModelTabele extends AbstractTableModel {

    HashMap<String, Object> mapa;
    StorageBroker sb;
    Fakultet f;

    public KontaktModelTabele(Fakultet f) {
        this.f = f;
        sb = new StorageBroker(f);

    }

    @Override
    public int getRowCount() {

        return f.getKontakti().size();
    }

    @Override
    public int getColumnCount() {
        return 2;
    }

    @Override
    public String getColumnName(int i) {

        switch (i) {
            case 0:

                return "Telefon";
            case 1:
                return "Sluzba/lice";
            default:
                return "Nedefinisana Kolona";
        }

    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Kontakt kon = (Kontakt) f.getKontakti().get(rowIndex);
        if (columnIndex == 0) {
            return kon.getTelefon();
        } else {
            return kon.getOpis();
        }
    }

}
